package com.fmsz.xmly.fragments;


import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;

import com.fmsz.xmly.R;
import com.fmsz.xmly.activitys.myselfactivity.HistoryActivity;
import com.fmsz.xmly.activitys.myselfactivity.LoginActivity;
import com.fmsz.xmly.activitys.myselfactivity.MyCollectionActivity;
import com.fmsz.xmly.activitys.myselfactivity.MyDeviceActivity;
import com.fmsz.xmly.activitys.myselfactivity.SettingActivity;
import com.fmsz.xmly.activitys.myselfactivity.SuggestionActivity;

/**
 * A simple {@link Fragment} subclass.
 */
public class MyselfFragment extends Fragment implements View.OnClickListener {

    private ImageView setting_normal;
    private ImageView myspace_head_img_default;
    private TextView login;
    private RelativeLayout record;
    private RelativeLayout manage;
    private RelativeLayout message;
    private RelativeLayout shopping;
    private RelativeLayout xibi;
    private RelativeLayout my_collect;
    private RelativeLayout play_record;
    private RelativeLayout praised;
    private RelativeLayout my_points;
    private RelativeLayout store;
    private RelativeLayout me_order;
    private RelativeLayout coupon;
    private RelativeLayout category_game;
    private RelativeLayout setting_carmode;
    private RelativeLayout my_device;
    private RelativeLayout find_friend;
    private RelativeLayout bind_img;
    private RelativeLayout tallour;
    private RelativeLayout setting_entry;

    public MyselfFragment() {
        // Required empty public constructor
    }


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        return inflater.inflate(R.layout.fragment_myself, container, false);
    }

    @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);

        setting_normal = (ImageView) view.findViewById(R.id.setting_normal);
        setting_normal.setOnClickListener(this);

        myspace_head_img_default = (ImageView) view.findViewById(R.id.myspace_head_img_default);
        myspace_head_img_default.setOnClickListener(this);

        login = (TextView) view.findViewById(R.id.login);
        login.setOnClickListener(this);

        record = (RelativeLayout) view.findViewById(R.id.record);
        record.setOnClickListener(this);

        manage = (RelativeLayout) view.findViewById(R.id.manage);
        manage.setOnClickListener(this);

        message = (RelativeLayout) view.findViewById(R.id.message);
        message.setOnClickListener(this);

        shopping = (RelativeLayout) view.findViewById(R.id.shopping);
        shopping.setOnClickListener(this);

        xibi = (RelativeLayout) view.findViewById(R.id.xibi);
        xibi.setOnClickListener(this);

        my_collect = (RelativeLayout) view.findViewById(R.id.my_collect);
        my_collect.setOnClickListener(this);

        play_record = (RelativeLayout) view.findViewById(R.id.play_record);
        play_record.setOnClickListener(this);

        praised = (RelativeLayout) view.findViewById(R.id.praised);
        praised.setOnClickListener(this);

        my_points = (RelativeLayout) view.findViewById(R.id.my_points);
        my_points.setOnClickListener(this);

        store = (RelativeLayout) view.findViewById(R.id.store);
        store.setOnClickListener(this);

        me_order = (RelativeLayout) view.findViewById(R.id.me_order);
        me_order.setOnClickListener(this);

        coupon = (RelativeLayout) view.findViewById(R.id.coupon);
        coupon.setOnClickListener(this);

        category_game = (RelativeLayout) view.findViewById(R.id.category_game);
        category_game.setOnClickListener(this);

        setting_carmode = (RelativeLayout) view.findViewById(R.id.setting_carmode);
        setting_carmode.setOnClickListener(this);

        my_device = (RelativeLayout) view.findViewById(R.id.my_device);
        my_device.setOnClickListener(this);

        find_friend = (RelativeLayout) view.findViewById(R.id.find_friend);
        find_friend.setOnClickListener(this);

        bind_img = (RelativeLayout) view.findViewById(R.id.bind_img);
        bind_img.setOnClickListener(this);

        tallour = (RelativeLayout) view.findViewById(R.id.tallour);
        tallour.setOnClickListener(this);

        setting_entry = (RelativeLayout) view.findViewById(R.id.setting_entry);
        setting_entry.setOnClickListener(this);

    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.setting_normal://设置按钮
                Intent setting_normal = new Intent(getContext(), SettingActivity.class);
                startActivity(setting_normal);
                getActivity().overridePendingTransition(R.anim.slide_in_left, R.anim.leave_in_button);
                break;
            case R.id.myspace_head_img_default://头像
                Intent myspace_head_img_default = new Intent(getContext(), LoginActivity.class);
                startActivity(myspace_head_img_default);
                getActivity().overridePendingTransition(R.anim.push_in_buttom, R.anim.leave_in_button);
                break;
            case R.id.login://登录
                Intent login = new Intent(getContext(), LoginActivity.class);
                startActivity(login);
                getActivity().overridePendingTransition(R.anim.push_in_buttom, R.anim.leave_in_button);
                break;
            case R.id.record://录音
                Intent record = new Intent(getContext(), LoginActivity.class);
                startActivity(record);
                getActivity().overridePendingTransition(R.anim.push_in_buttom, R.anim.leave_in_button);
                break;
            case R.id.manage://主播管理中心
                Intent manage = new Intent(getContext(), LoginActivity.class);
                startActivity(manage);
                getActivity().overridePendingTransition(R.anim.push_in_buttom, R.anim.leave_in_button);
                break;
            case R.id.message://消息中心
                Intent message = new Intent(getContext(), LoginActivity.class);
                startActivity(message);
                getActivity().overridePendingTransition(R.anim.push_in_buttom, R.anim.leave_in_button);
                break;
            case R.id.shopping://已购声音
                Intent shopping = new Intent(getContext(), LoginActivity.class);
                startActivity(shopping);
                getActivity().overridePendingTransition(R.anim.push_in_buttom, R.anim.leave_in_button);
                break;
            case R.id.xibi://喜币金额
                Intent xibi = new Intent(getContext(), LoginActivity.class);
                startActivity(xibi);
                getActivity().overridePendingTransition(R.anim.push_in_buttom, R.anim.leave_in_button);
                break;
            case R.id.my_collect://我的订阅
                Intent my_collect = new Intent(getContext(), MyCollectionActivity.class);
                startActivity(my_collect);
                getActivity().overridePendingTransition(R.anim.slide_in_left, R.anim.leave_in_button);
                break;
            case R.id.play_record://播放历史
                Intent play_record = new Intent(getContext(), HistoryActivity.class);
                startActivity(play_record);
                getActivity().overridePendingTransition(R.anim.slide_in_left, R.anim.leave_in_button);
                break;
            case R.id.praised://被赞过的
                Intent praised = new Intent(getContext(), LoginActivity.class);
                startActivity(praised);
                getActivity().overridePendingTransition(R.anim.push_in_buttom, R.anim.leave_in_button);
                break;
            case R.id.my_points://我的积分
                Toast.makeText(getContext(), "进入积分商城", Toast.LENGTH_SHORT).show();
                break;
            case R.id.store://喜马拉雅商城
                Toast.makeText(getContext(), "喜马拉雅商城", Toast.LENGTH_SHORT).show();
                break;
            case R.id.me_order://我的商城订单
                Intent me_order = new Intent(getContext(), LoginActivity.class);
                startActivity(me_order);
                getActivity().overridePendingTransition(R.anim.push_in_buttom, R.anim.leave_in_button);
                break;
            case R.id.coupon://我的优惠券
                Intent coupon = new Intent(getContext(), LoginActivity.class);
                startActivity(coupon);
                getActivity().overridePendingTransition(R.anim.push_in_buttom, R.anim.leave_in_button);
                break;
            case R.id.category_game://游戏中心
                Toast.makeText(getContext(), "游戏中心", Toast.LENGTH_SHORT).show();
                break;
            case R.id.setting_carmode://车遭模式

                break;
            case R.id.my_device://智能硬件设备
                Intent my_device = new Intent(getContext(), MyDeviceActivity.class);
                startActivity(my_device);
                getActivity().overridePendingTransition(R.anim.push_in_buttom, R.anim.leave_in_button);
                break;
            case R.id.find_friend://找听友
                Intent find_friend = new Intent(getContext(), LoginActivity.class);
                startActivity(find_friend);
                getActivity().overridePendingTransition(R.anim.push_in_buttom, R.anim.leave_in_button);
                break;
            case R.id.bind_img://绑定账号
                Intent bind_img = new Intent(getContext(), LoginActivity.class);
                startActivity(bind_img);
                getActivity().overridePendingTransition(R.anim.push_in_buttom, R.anim.leave_in_button);
                break;
            case R.id.tallour://意见反馈
                Intent tallour = new Intent(getContext(), SuggestionActivity.class);
                startActivity(tallour);
                getActivity().overridePendingTransition(R.anim.push_in_buttom, R.anim.leave_in_button);
                break;
            case R.id.setting_entry://设置
                Intent setting_entry = new Intent(getContext(), SettingActivity.class);
                startActivity(setting_entry);
                getActivity().overridePendingTransition(R.anim.slide_in_left, R.anim.leave_in_button);
                break;

        }

    }

}
